package com.topisv.tms.repository;


import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.AlreadyDeductedOut;

public interface AlreadyDeductedOutDao extends PagingAndSortingRepository<AlreadyDeductedOut, Long>, JpaSpecificationExecutor<AlreadyDeductedOut>{
	
	
	@Query("SELECT T FROM AlreadyDeductedOut t WHERE t.outinstorageId IN ( select t.id from OutstorageInfo t where  t.opeTime >= ?1 and t.opeTime <= ?2 )")
	List<AlreadyDeductedOut> findByOutinstorageIds(Date startTime,Date endTime);
	
	@Query("SELECT T FROM AlreadyDeductedOut t WHERE t.outinstorageId = ?1")
	AlreadyDeductedOut findByOutinstorageId(Long outinstorageId);
	
}
